<template>
  <view class="swiper_wrap">
    <swiper autoplay>
      <swiper-item v-for="item in swiperInfo" :key="item.id">
        <image :src="item.bimage" mode="aspectFit" />
      </swiper-item>
    </swiper>
  </view>
</template>

<script>
export default {
  data() {
    return {
      // 轮播图数据
      swiperInfo: []
    };
  },
  onLoad(){
    this.$http({
      url: `/api/index/index`
    }).then(res => {
      this.swiperInfo = res.data;
    });
  },
  onShow() {
    this.$http({
      url: `/api/index/index`
    }).then(res => {
      this.swiperInfo = res.data;
    });
  },
  mounted() {
    this.$http({
      url: `/api/index/index`
    }).then(res => {
      this.swiperInfo = res.data;
    });
  }
};
</script>

<style lang='scss' scoped>
.swiper_wrap {
  height: 240px;
}
swiper {
  height: 240px;
  .swiper-item {
    border: 1px solid #000;
    image {
      width: 100%;
      height: 100%;
    }
  }
}
</style>